package org.brain.pojos;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * User entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "USER", schema = "PUBLIC", catalog = "PUBLIC")
public class User implements java.io.Serializable {

	// Fields

	private String username;
	private String password;
	private String userrole;
	private Set<Treemenu> treemenus = new HashSet<Treemenu>(0);

	// Constructors

	/** default constructor */
	public User() {
	}

	/** minimal constructor */
	public User(String password, String userrole) {
		this.password = password;
		this.userrole = userrole;
	}

	/** full constructor */
	public User(String password, String userrole, Set<Treemenu> treemenus) {
		this.password = password;
		this.userrole = userrole;
		this.treemenus = treemenus;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "USERNAME", unique = true, nullable = false, length = 30)
	public String getUsername() {
		return this.username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	@Column(name = "PASSWORD", nullable = false, length = 30)
	public String getPassword() {
		return this.password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	@Column(name = "USERROLE", nullable = false, length = 10)
	public String getUserrole() {
		return this.userrole;
	}

	public void setUserrole(String userrole) {
		this.userrole = userrole;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "user")
	public Set<Treemenu> getTreemenus() {
		return this.treemenus;
	}

	public void setTreemenus(Set<Treemenu> treemenus) {
		this.treemenus = treemenus;
	}

}